package com.culturalCenter.dataCenter.controller.web;

import com.culturalCenter.dataCenter.Utils.ApiResult;
import com.culturalCenter.dataCenter.Utils.ResultCode;
import com.culturalCenter.dataCenter.customEntity.responseParam.wifilocation.WifiLocationResponse;
import com.culturalCenter.dataCenter.globalconfig.Interface.ApiVersion;
import com.culturalCenter.dataCenter.globalconfig.Interface.CustomVersion;
import com.culturalCenter.dataCenter.service.wifilocation.WifiLocationService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiImplicitParams;
import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;
import java.util.List;

import static com.culturalCenter.dataCenter.Utils.ApiResult.instance;

/**
 * wifi定位
 *
 * @Author zhao
 * @Date 2020/12/21 11:32
 */
@RestController
@RequestMapping("/{version}/wifiLocation")
@Api("wifi定位")
@ApiVersion(CustomVersion.VERSION_1)
@Deprecated
@Slf4j
public class WifiLocationController {

    @Resource
    WifiLocationService wifiLocationService;

    /**
     * 根据用户id获取用户wifi定位信息
     */
    @GetMapping("/singleLocationInfo")
    @ApiImplicitParams(@ApiImplicitParam(name = "id", value = "用户id", paramType = "query", dataType = "String"))
    public ApiResult<WifiLocationResponse> getSingleLocationInfo(@RequestParam String id) {
        WifiLocationResponse response = wifiLocationService.getLocationInfo(id);
        return instance(ResultCode.SUCCESS, response);
    }

    /**
     * 获取所有在线用户的定位信息
     */
    @GetMapping("/onlineLocationInfo")
    public ApiResult<List<WifiLocationResponse>> getOnlineLocationInfo() {
        List<WifiLocationResponse> responseList = wifiLocationService.getOnlineLocationInfo();
        return instance(ResultCode.SUCCESS, responseList);
    }

}
